'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {

  async findalllength() {
    const { ctx } = this;
    try {
      const arrlist = [];
      const userlength = await ctx.model.User.count();
      const release = await ctx.model.Release.count();
      const appointment = await ctx.model.Appointment.count();
      const fild = await ctx.model.Field.count();
      const tutorial = await ctx.model.Tutorial.count();
      arrlist.push(userlength, release, appointment, fild, tutorial);
      ctx.body = { success: true, data: arrlist };
    } catch (e) {
      ctx.body = { success: false };
    }
  }

}

module.exports = HomeController;
